package com.zihan.controller;


import com.zihan.domain.entity.ProjectMilestone;
import com.zihan.domain.result.Result;
import com.zihan.service.IProjectMemberService;
import com.zihan.service.IProjectMilestoneService;
import com.zihan.service.impl.ProjectMilestoneServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.management.relation.RelationSupport;
import java.util.List;

/**
 * <p>
 * 项目节点表 前端控制器
 * </p>
 *
 * @author zhangzihan
 * @since 2025-10-20
 */
@RestController
@RequestMapping("/project-milestone")
public class ProjectMilestoneController {

    @Resource
    private IProjectMemberService projectMemberService;
    @Resource
    private IProjectMilestoneService projectMilestoneService;


    //保存项目节点
    @PostMapping("/milestone/add")
    public Result<String> save(@RequestBody ProjectMilestone projectMilestone) {
        return projectMilestoneService.saveData(projectMilestone);
    }

    // 根据项目id获取节点列表
    @GetMapping("/list/{id}")
    public Result<List<ProjectMilestone>> list(@PathVariable Long id) {
        return projectMilestoneService.getList(id);
    }

    @PutMapping("/update")
    public Result<String> update(@RequestBody ProjectMilestone projectMilestone) {
        return projectMilestoneService.updateData(projectMilestone);
    }
}
